<?php
$host = "127.0.0.1";
$port = 8080;

//$host = "61.58.40.112";
//$port =8359;

//$proxy_host="192.168.95.6"
//$conn_port=8080;

$fp = fsockopen($host , $port , $errno , $errstr , 30);
if(!$fp){
	echo $errno . " : " . $errstr . "<br>";
}


/**app login module **/
/**$xml = "<?xml version='1.0' encoding='utf-8'?>";
$xml .= "<entry>";
$xml .= "<usr>jackie's honey</usr>";
$xml .= "<lang></lang>";
$xml .= "</entry>";**/

/**dpf login module**/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .="<tel>6666</tel>";
$xml .="<dev>id6</dev>";
$xml .="<model>modelname2</model>";
$xml .="<max  h='600' w='800' q='1' />";
$xml .="<min w='80' h='60' q='2'/>";
$xml .="<def  h='6' w='8'/>";
$xml .= "</entry>";*/


/**app user modify language **/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .="<lang></lang>";
$xml .="</entry>";*/

/** dpf user modify def size **/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .= "<device>";
$xml .= "<def w='60' h='30'/>";
$xml .= "</device>";
$xml .="</entry>";*/

/**app user send card **/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .= "<link>http://localhost:83/warabi/RSSFeed.xml</link>";
$xml .= "<description>this is the third invitation</description>";
$xml .= "<photo>2</photo>";
$xml .= "<photo_id><id>5321786942763382802</id><id>5321786951070193570</id></photo_id>";
$xml .= "<invite><to>feifei</to></invite>";
$xml .= "<invite><to>martin</to></invite>";
$xml .= "<invite><to>333333</to></invite>";
$xml .="</entry>";*/

/** app user resend card **/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .= "<invite><id>1</id></invite>";
$xml .= "<invite><id>5</id></invite>";
$xml .= "<invite><id>20</id></invite>";
$xml .="</entry>";*/

/** app user all card state**/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .= "<invite><id>1</id></invite>";
$xml .= "<invite><id>5</id></invite>";
$xml .= "<invite><id>20</id></invite>";
$xml .="</entry>";*/

/** app user delete all card **/
/*$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml .= "<entry>";
$xml .= "<invite><id>2</id></invite>";
$xml .= "<invite><id>4</id></invite>";
$xml .= "<invite><id>7</id></invite>";
$xml .="</entry>";*/

$usr = rawurlencode('+M8g+Y+AC9HjvFefDsk1mg==');
$dev =  rawurlencode('AIM_DPF');
#$out = "GET /func/app/card_resend.php?sender=jackie  HTTP/1.1 \r\n";
#$out = "GET /func/dpf/card_list.php?usr=".$usr."&dev=".$dev."&type=old  HTTP/1.1 \r\n";
#$out = "GET http://localhost:83/warabi/func/dpf/card_magic_uri.php?cardid=1===id1 HTTP/1.1 \r\n";
#$out = "GET /func/app/card_send.php?sender=jackie  HTTP/1.1 \r\n";
#$out = "GET /func/app/card_del.php?sender=jackie&id=5  HTTP/1.1 \r\n";
#$out = "GET /func/dpf/tel_mod.php?usr=111111&dev=id1  HTTP/1.1 \r\n";
#$out = "GET /func/app/user_mod.php?sender=jackie  HTTP/1.1 \r\n";
#$out = "GET /func/dpf/dpf_login.php  HTTP/1.1 \r\n";
#$out = "GET /func/app/card_allstat.php HTTP/1.1 \r\n";
#$out = "GET /func/app/card_alldel.php?sender=jackie HTTP/1.1 \r\n";
#$out = "GET /func/dpf/card_list.php?usr=".$usr."&dev=".$dev." HTTP/1.1 \r\n";
#$out = "GET /func/app/sent_list.php?sender=yangyitt@gmail.com  HTTP/1.1 \r\n";
$out = "GET /func/dpf/card_magic_uri.php?cardid=478%3D%3D%3DAIM_DPF  HTTP/1.1 \r\n";

$out .= "Host: 127.0.0.1\r\n";
$out .= "Content-Type: text/xml\r\n";
$out .= "Content-Length:".strlen($xml)."\r\n";
#$out .= "X-WSSE: UsernameToken Username=\"111111\", PasswordDigest=\"fxPu/ob5TP/MQTh8HQ1SJQ==\", Nonce=\"Uh95NQlviNpJQR1MmML+zq6pFxE=\", Created=\"2005-01-18T03:20:15Z\"\r\n";
#$out .= "X-WSSE: UsernameToken Username=\"jackie\", PasswordDigest=\"bd8DA8gEV1FVJINGSriYnw==\", Nonce=\"Uh95NQlviNpJQR1MmML+zq6pFxE=\", Created=\"2005-01-18T03:20:15Z\"\r\n";
#$out .= "Accept: */*\r\n";
#$out .= "Accept-Language: utf-8\r\n";
$out .= "Connection: Close\r\n";
$out .= "\r\n";
$out .= $xml;
$out .= "\r\n\r\n\r\n\r\n";

fwrite($fp , $out);

$headers = "";
while ($str = trim(fgets($fp, 4096)))
     $headers .= "$str\n";
echo "\n";
$body = "";
while (!feof($fp))
     $body .= fgets($fp, 4096);
echo $headers.'<br />';
echo $body;
fclose($fp);
?>